<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<!-- Meta, title, CSS, favicons, etc. -->
	<meta charset="utf-8">
	<title>温州麻将内容管理系统</title>
	<meta name="keywords" content="Admin">
	<meta name="description" content="Admin">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<!-- Core CSS  -->
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/bootstrap.css">
	
	<!-- Theme CSS -->
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/theme.css">
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/pages.css">
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/plugins.css">
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/responsive.css">

	<!-- Boxed-Layout CSS -->
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/boxed.css">

	<!-- Demonstration CSS -->
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/demo.css">

	<!-- Your Custom CSS -->
	<link rel="stylesheet" type="text/css" href="/admin/Public/admin/css/custom.css">
  <style type="text/css">

  #dv{
    width: 400px;
    margin: 0 auto;
  }
  #msg{
    width: 100%;
    height: 50px;
    line-height: 50px;
    color: #fff;
    font-size: 18px;
    background: rgba(183,48,48,0.7);
    text-align: center;
    display: none;
    position: relative;
    top: 30px;
  }
  </style>

</head>

<body class="login-page">

<!-- Start: Main -->
<div id="main">
  <div class="container">
    <div class="row">
      <div id="page-logo"></div>
    </div>
    <div class="row">
      <div class="panel">
        <div class="panel-heading">
          <div class="panel-title"><img src="/admin/Public/admin/images/logo.png" alt="logo"></div>
		</div>
        <form action="" class="cmxform" id="altForm" method="post">
          <div class="panel-body">
            <div class="form-group">
              <div class="input-group"> <span class="input-group-addon">用户名</span>
                <input type="text" name="accounts" placeholder="请输入代理 ID或手机号码" class="form-control phone" maxlength="11" autocomplete="off" placeholder="" id="accounts">
              </div>
            </div>
            <div class="form-group">
              <div class="input-group"> <span class="input-group-addon">密&nbsp;&nbsp;&nbsp;码</span>
                <input type="password" placeholder="请输入 6-10 位的数字或字母密码" name="password" class="form-control product" maxlength="10" autocomplete="off" placeholder="" id="password">
              </div>
            </div>
			<input name="remember" type="checkbox" value="1" />记住我

			  <div class="form-group">
              <div class="input-group"> <span class="input-group-addon">验&nbsp;证&nbsp;码</span>
                 <input id="verify" style="height:40px;" name="verify" type="text" class="txt" placeholder="请输入验证码">
                <img style="width:102px;height:40px;margin-top:-6px;" id="getcode" src="<?php echo '/admin/Verify' ?>" alt="看不清楚？" onclick="go()">
              </div>
            </div>
                      </div>
          <div class="panel-footer"> <span class="panel-title-sm pull-left" style="padding-top: 7px;"></span>
            <div class="form-group margin-bottom-none">
              <input class="btn btn-primary pull-right" id= "_botton" type="botton" value="登 录" style="width: 100px;" />
              <div class="clearfix"></div>
            </div>
          </div>
        </form>
      </div>
      <div id="dv">
        <p id="msg"></p>
      </div>
    </div>
  </div>
</div>
<!-- End: Main --> 

<!-- Core Javascript - via CDN --> 
<script src="/admin/Public/admin/js/jquery.min.js"></script> 
<script src="/admin/Public/admin/js/jquery-ui.min.js"></script> 
<script src="/admin/Public/admin/js/bootstrap.min.js"></script> <!-- Theme Javascript --> 
<script type="text/javascript" src="/admin/Public/admin/js/uniform.min.js"></script> 
<script type="text/javascript" src="/admin/Public/admin/js/main.js"></script>
<script type="text/javascript" src="/admin/Public/admin/js/custom.js"></script> 
<script type="text/javascript">

jQuery(document).ready(function() {

	// Init Theme Core 	  
	Core.init();   
	
});
function go() {
	document.getElementById("getcode").src = "<?php echo '/admin/Verify' ?> ?"+Math.random();
	}

$(function(){  
    $('#_botton').click(function(){  
        // console.log("click===>");
        var $unameVal = $.trim($('#accounts').val());  
        var $upwdVal = $.trim($('#password').val());  
        var $verify = $.trim($('#verify').val());  
        // var $isagree = $.trim($('#isagree').val()); 
        // alert($isagree);return false;  
        //如果没有填写数据,则直接返回false.不执行ajax提交操作  
        if($unameVal == ''){  
             
             $('#msg').html('用户名不能为空').show ().delay (2000).fadeOut(); 
            return false;  
        }
        if($upwdVal == ''){  
             $('#msg').html('密码不能为空').show ().delay (2000).fadeOut(); 
            return false;  
        }
        if($verify == ''){  
             $('#msg').html('验证码不能为空').show ().delay (2000).fadeOut(); 
            return false;  
        }
        // if($isagree != 2){  
        //      $('#msg').html('请在阅读《合作协议》后在同意前打钩，才能登陆').show ().delay (2000).fadeOut(); 
        //     return false;  
        // }    
        
        $.post('/admin/checkLogin', {uname : $unameVal,upwd : $upwdVal,verify : $verify},
            function($data){  
            if($data['state'] == 1){  
                $('#msg').css('background','#20A74E').html('登陆成功').show ().delay (1500);
                location.href='http://<?php echo $_SERVER['SERVER_NAME']; ?>/admin/index.html';
            }
            else if($data['state'] == 0){  
                
                $('#msg').html('用户名或密码错误').show ().delay (3000).fadeOut();
                return false;  
            }
            else if($data['state'] == 2){ 
                
                $('#msg').html('验证码错误').show ().delay (3000).fadeOut();
                return false;  
            }
            else if($data['state'] == 3){ 
                
                $('#msg').html('您的权限不足').show ().delay (3000).fadeOut();
                return false;  
            }       
        },"json");  
        
    });  
});  

document.onkeydown = function (e) {
            var theEvent = window.event || e;
            var code = theEvent.keyCode || theEvent.which;
            if (code == 13) {
                $("#_botton").click();
            }
        }

</script>
</body>

</html>